<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Blog Post</title>
    <meta name="description" content="Your Blog post page description"/>
    <link href="https://fonts.googleapis.com/css?family=Arimo:400,600,700" rel="stylesheet">
    <link href="/static/css/font-awesome.min.css" rel="stylesheet">
    <link rel="shortcut icon" type="image/png" href="/static/images/favicon.png">
    <link href="/static/styles/main.css" rel="stylesheet">


    <script type="text/javascript" src="/static/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery.form.min.js"></script>


  </head>
  <body id="top">
    <div class="page">
      <header>
        <div class="pp-header">
          <nav class="navbar navbar-expand-lg navbar-light">
            <div class="container"><a href="index.html"><img src="/static/images/favicon.png"></a><a class="navbar-brand" href="index.html">Photo Perfect</a>
              <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
              <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
                <ul class="navbar-nav ml-auto">
                  <li class="nav-item active"><a class="nav-link" href="/">主页</a>
                  </li>
                  <li class="nav-item"><a class="nav-link" href="/add_image">添加照片</a>
                  </li>
                  <li class="nav-item"><a class="nav-link"  id="delete">删除照片</a>
                      <script>
                          $(function () {

                              $("#delete").click(function () {

                                  $.ajax({
                                      url: '/delete_image',
                                      type: "post",
                                      data: {image_id:"{{ image.id }}"}
                                  }).success(function (resp) {

                                      alert(resp.errmsg)
                                      location.href = "/"
                                  }).error(function () {

                                      alert('网络错误')

                                  })
                              })

                          })
                      </script>
                  </li>
                  <li class="nav-item"><a class="nav-link" href="contact.html">新建相册</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
        </div>
      </header>
      <div class="page-content">
        <div class="container">
<div class="pp-section pp-container-readable">
  <div class="pp-post"><a class="h3" href="blog-post.html">You can do anything if you believe</a>

    </div><img class="img-fluid mt-3" src="{{ image.photo_path }}" alt="Blog Image"/>
    {{ image.photo_dig_title }}

    {{ image.photo_dig }}
  </div>

  <div class="pp-section"></div>
  <div class="row" id="pp-drop-comment">
    <div class="col">
      <div class="h4 mb-3">为照片描述</div>
      <form>
        <div class="row">
          <div class="col-md-6 col-sm-12 mb-3">
            <input class="form-control" type="text" name="last-name" placeholder="图片描述标题" id="title"/>
          </div>
        </div>
        <div class="row mb-3">
          <div class="col">
            <textarea class="form-control" type="text" name="message" placeholder="图片描述" id="dis"></textarea>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <button class="btn btn-primary" type="button" id="push_butt">提交</button>


              <script>

                  $(function () {

                      $("#push_butt").click(function () {

                          {#获取数据#}

                          var dig_title = $("#title").val();
                          var image_dis = $("#dis").val();

                          $.ajax({
                              url:"/add_image_dis",
                              type:"post",
                              data:{dig_title:dig_title,image_dis:image_dis,"image_id":"{{ image.id }}"}
                          }).success(function (resp) {

                              alert(resp.errmsg)
                              location.reload()

                          }).error(function () {

                              alert('网络错误')

                          })

                      })

                  })


              </script>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<div class="pp-section"></div></div>
    </div>
  </body>
</html>